package com.lyp.crm.service;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.lyp.crm.dao.QiandaoMapper;
import com.lyp.crm.entity.Fenye;
import com.lyp.crm.entity.Qiandao;
@Service
public class QiandaodaoImp implements Qiandaodao {
	
	SimpleDateFormat sdf= new SimpleDateFormat("yyyy-MM-dd");
	Date date = new Date();
	@Autowired
	private QiandaoMapper Qiandaomapper;
	@Override
	public Fenye<Qiandao> SelectQiandao(Fenye<Qiandao> fenye) {
		System.out.println(fenye);
		List<Qiandao> list = Qiandaomapper.SelectQiandao(fenye);
		Integer count = Qiandaomapper.SelectQiandaoCount(fenye);
		fenye.setRows(list);
		fenye.setTotal(count);
		return fenye;
	}
	@Override
	public Integer updateQiandao(Integer uid, Integer sui) {
		Qiandao qiandao=new Qiandao();
		qiandao.setQuid(uid);
		String format = sdf.format(date);
		qiandao.setQdate(format);
		if (sui==1) {
			qiandao.setQqiantui("����");
		} else {
			qiandao.setQqiantui("����");
		}
		
		return Qiandaomapper.updateQiandao(qiandao);
	}

}
